import { IParam, EntityBase } from "@/core";
import { IIBIZStorage } from './interface/i-ibiz-storage';
import IBIZStorageKeys from './ibiz-storage-keys';

/**
 * 存储基类
 * 基于template/src/api/{{appEntities}}/{{appEntities}}-base.ts.hbs生成  
 *
 * @export
 * @abstract
 * @class IBIZStorageBase
 * @extends { EntityBase }
 * @implements { IIBIZStorage }
 */
export abstract class IBIZStorageBase extends EntityBase implements IIBIZStorage {
	/**
	 * 实体名称
	 *
	 * @readonly
	 * @type {string}
	 * @memberof IBIZStorageBase
	 */
	get srfdename(): string {
		return 'IBIZSTORAGE';
	}

	/**
     * 当前实体所有属性
     *
     * @protected
     * @type {string[]}
     * @memberof IBIZStorageBase
     */
    protected get keys(): string[] {
        return IBIZStorageKeys;
    }

	/**
	 * Creates an instance of ConstactOppoBase.
	 * @param {*} [data]
	 * @memberof IBIZStorageBase
	 */
	constructor(data?: any) {
		super();
		this.setData(data);
	}

	get srfkey(): string {
		return this.ibizstorageid;
	}

	set srfkey(val: string) {
		this.ibizstorageid = val;
	}

	/**
	 * 存储标识
	 **/
	ibizstorageid?: any;
	
	/**
	 * 生产厂商
	 **/
	producer?: any;
	
	/**
	 * 更新人
	 **/
	updateman?: any;
	
	/**
	 * 单位
	 **/
	unit?: any;
	
	/**
	 * 分组类型
	 **/
	ibizhardwaretype?: any;
	
	/**
	 * 建立人
	 **/
	createman?: any;
	
	/**
	 * 更新时间
	 **/
	updatedate?: any;
	
	/**
	 * 产品编号
	 **/
	productuid?: any;
	
	/**
	 * 单价
	 **/
	unitprice?: any;
	
	get srfmajortext(): string {
		return this.ibizstoragename;
	}

	set srfmajortext(val: string) {
		this.ibizstoragename = val;
	}
	/**
	 * 存储名称
	 **/
	ibizstoragename?: any;
	
	/**
	 * 建立时间
	 **/
	createdate?: any;
	

	/**
	 * 重置实体数据
	 *
	 * @param {IParam} [data={}]
	 * @memberof IBIZStorageBase
	 */
	reset(data: IParam = {}): void {
		super.reset(data);
		this.ibizstorageid = data.ibizstorageid || data.srfkey;
		this.ibizstoragename = data.ibizstoragename || data.srfmajortext;
	}
}